package security

import (
	"sync"
)

// MalwareFullInfo 结构体
type MalwareFullInfo struct {
	// 恶意代码列表(任务完成时才返回)
	MalwareDetails []MalwareDetail `json:"malware_details,omitempty" xml:"malware_details>malware_detail,omitempty"`
	// 恶意代码数量信息(任务完成时才返回)
	MalwareCount *MalwareCount `json:"malware_count,omitempty" xml:"malware_count,omitempty"`
	// 子任务状态: 1-已完成,2-处理中,3-处理出错,4-处理超时
	Status int64 `json:"status,omitempty" xml:"status,omitempty"`
}

var poolMalwareFullInfo = sync.Pool{
	New: func() any {
		return new(MalwareFullInfo)
	},
}

// GetMalwareFullInfo() 从对象池中获取MalwareFullInfo
func GetMalwareFullInfo() *MalwareFullInfo {
	return poolMalwareFullInfo.Get().(*MalwareFullInfo)
}

// ReleaseMalwareFullInfo 释放MalwareFullInfo
func ReleaseMalwareFullInfo(v *MalwareFullInfo) {
	v.MalwareDetails = v.MalwareDetails[:0]
	v.MalwareCount = nil
	v.Status = 0
	poolMalwareFullInfo.Put(v)
}
